home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
powerb5.zip
/
P5UTL008.TIP
< prev
next >
Wrap
Text File
|
1993-06-01
|
4KB
|
95 lines
Backup programs come in handy when you need to back up an
entire hard disk, but for daily, incremental backups,
they're just a pain. When you have only 50K or 100K to back
up, whatever speed advantage the programs have in the actual
copying is lost in the time it takes to load them. Worse,
some of them require a fresh floppy for every incremental
backup, and that can leave you with a lot of floppies and
only a few small files on each one.
So I wrote DAILYBAC.BAT [see below], which uses the DOS
XCOPY command, and DATEDIR.BAS [included in the P5UTL
directory on your PowerBase *.* Volume 5 diskette] to back
up my incremental work onto floppies. The batch file makes a
directory on your floppy named with the date, then copies
all appropriate files into that directory and the
subdirectories it creates within it. By copying files into
date directories, you can have more than one backup on a
single floppy. DAILYBAC requires DOS 5.0.
My batch file is set up for my hard disk; you'll want to
change yours to match your hard disk's configuration.
Because I keep my data files in subdirectories of C:\DATA,
my batch file can use one XCOPY command to copy each file
(*.*) in C:\DATA to the date directory (%TODAY%) in drive
A:. The /S parameter tells XCOPY also to copy the files in
every nonempty subdirectory of the directory named in the
first parameter (C:\DATA). The /M tells it to copy a file
only if it's been modified (has its archive bit set), and to
turn off the archive bit once the file is copied.
The /V says verify that the copy is good. The /W says prompt
me for a keystroke before copying begins. If you have more
than one branch of files to back up, you can use additional
XCOPY commands.
Because I do not want to back up any files with BAK or TMP
extensions or any files in C:\DATA\JUNK or its
subdirectories, my batch file starts off with three ATTRIB
commands that turn the archive bits off (-A) for all BAK and
TMP files (*.BAK and *.TMP) in C:\DATA and its
subdirectories (/S) and for all files (*.*) in C:\DATA\JUNK
and its subdirectories (/S).My example assumes that you will
keep DATEDIR.BAS in your C:\UTIL directory. It does not
matter which directory you keep it in, so long as the path
to that directory is included in DAILYBAC's QBASIC command.
You will want DAILYBAC.BAT and QBASIC.EXE (which comes with
DOS 5.0) in directories in your AUTOEXEC.BAT's PATH
statement.
When a floppy is full, you'll get an 'Insufficient disk
space' message. Don't worry about it. Simply put in a floppy
and start the batch file over. The second time around, XCOPY
will ignore the files it's already backed up.
Mary Keaton
New York, New York
Editor's Note: You can use the Alt-F command to extract and
modify DAILYBAC.BAT for your own system; DATEDIR.BAS is in
the P5UTL directory of your PowerBase *.* Volume 5 diskette.
The DATEDIR.BAS program creates a batch file which in turn
sets an environment variable for use by DAILYBAC.BAT. This
isn't the only situation in which this technique might come
in handy. It's easy to adapt this technique so that the time
of day, the day of the week, and so on are stored in the
environment for easy access. One caveat: Make sure that you
have enough environment space to allow the SET command to
function. You might check out the tip "Two Ways to Save the
Environment" (printed in the August 1992 Star-Dot-Star and
included on the DOS menu of this volume of PowerBase *.*) if
you discover that you are running out of environment space.
---- BEGIN LISTING ----
@ECHO OFF
CLS
ATTRIB -A C:\DATA\*.BAK /S
ATTRIB -A C:\DATA\*.TMP /S
ATTRIB -A C:\DATA\JUNK\*.* /S
ECHO Please make sure a disk is in Drive A:
QBASIC /RUN C:\UTIL\DATEDIR > TEMP.BAT
CALL TEMP.BAT
DEL TEMP.BAT
XCOPY C:\DATA\*.* A:\%TODAY%\ /S /M /V /W
ECHO ALL DONE
---- END LISTING ----
Title: Basic Backups
Category: UTL
Issue Date: October, 1992
Editor: Brett Glass
Supplementary Files: P5UTL\DATEDIR.BAS
Filename: P5UTL008.TIP